﻿<Window x:Class="Controls.ComboBoxEnum"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:local="clr-namespace:Controls"
        Title="Enum bind to ComboBox" Height="119" Width="460">
    <Grid>
        <Grid.Resources>
            <Style TargetType="ComboBox">
                <Setter Property="Margin" Value="5"/>
                <Setter Property="HorizontalContentAlignment" Value="Center"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
            </Style>
            <Style TargetType="Button">
                <Setter Property="Margin" Value="5"/>
            </Style>
            <Style TargetType="Label">
                <Setter Property="Margin" Value="5"/>
                <Setter Property="HorizontalContentAlignment" Value="Right"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="FontWeight" Value="Black"/>
            </Style>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*" />
            <ColumnDefinition Width="3*" />
            <ColumnDefinition Width="1*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <ComboBox Grid.Column="1"  ItemsSource="{Binding Source={StaticResource enumValues}}" 
                  SelectedValue="{Binding Gender}" />
        <Button   Content="Info..." Grid.Column="2"  Grid.RowSpan="2" Click="Button_Click" />
        <Label Content="Literal: "   />
        <Label Grid.Row="1" Content="Translated: "   />
        <ComboBox Grid.Row="1" Grid.Column="1"
                  ItemsSource="{x:Static local:ComboBoxEnum.Descriptions}"
                  DisplayMemberPath="Roles"
                  SelectedValuePath="Gender"
                  SelectedValue="{Binding Gender}"/>
    </Grid>
</Window>
